package com.lixinlei.mc.api.controller;

import com.lixinlei.mc.api.bo.SmsDeviceBo;
import com.lixinlei.mc.api.bo.SmsSendTestBo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/notification/sms")
public class SmsController {

    /**
     * 1.获取短信服务器配置
     * @return
     */
    @RequestMapping(value = "/device", method = RequestMethod.GET)
    public ModelAndView getSmsDeviceInfo() {
        ModelAndView mv = new ModelAndView("alarmset_message_config");

        return mv;
    }


    /**
     * 2.短信服务器配置提交
     * @param id
     * @return
     */
    @RequestMapping(value = "/device/{id}", method = RequestMethod.POST)
    @ResponseBody
    public boolean updateSmsDeviceInfo(@PathVariable("id") Integer id,
                                       @RequestParam("cmd") String cmd,
                                       @RequestBody SmsDeviceBo smsDeviceBo) {

        return true;
    }

    /**
     * 3.发送测试短信
     * @param smsSendTestBo
     * @return
     */
    @RequestMapping(value = "", method = RequestMethod.POST)
    @ResponseBody
    public boolean sendTestSms(@RequestBody SmsSendTestBo smsSendTestBo,
                               @RequestParam("cmd") String cmd) {

        return true;
    }

    /**
     * 4.收件人列表
     * @return
     */
    @RequestMapping(value = "/receiver", method = RequestMethod.GET)
    @ResponseBody
    public String getReceiverList() {

        return "18599061666,19566322250";
    }

    /**
     * 5.收件人提交
     * @param cmd
     * @param receivers
     * @return
     */
    @RequestMapping(value = "/receiver", method = RequestMethod.POST)
    @ResponseBody
    public boolean updateReceiverList(@RequestParam("cmd") String cmd,
                                      @RequestBody String receivers) {

        return true;
    }

    /**
     * 6.短信模块是否启用
     * @return
     */
    @RequestMapping(value = "/status", method = RequestMethod.GET)
    @ResponseBody
    public boolean getSmsModelStatus() {

        return true;
    }

    /**
     * 7.短信模块启用状态变更
     * @param cmd
     * @param status
     * @return
     */
    @RequestMapping(value = "/status", method = RequestMethod.POST)
    @ResponseBody
    public boolean updateSmsModelStatus(@RequestParam("cmd") String cmd,
                                        @RequestBody boolean status) {

        return true;
    }

}
